﻿<Window xmlns:my="clr-namespace:KinectControl"  x:Class="VitrineInterativa.ElementDisplay"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:sys="clr-namespace:System;assembly=mscorlib"
             xmlns:Controls="clr-namespace:FluidKit.Controls;assembly=FluidKit"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:appControl="clr-namespace:VitrineInterativa"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:Samples="clr-namespace:FluidKit.Samples" 
        Title="Vitrine Interativa" KeyDown="Window_KeyDown" 
        WindowStyle="None" >    
    <Window.Resources>
        <Storyboard x:Key="sbVideoFull">
            <DoubleAnimation Storyboard.TargetName="vbCamera" Storyboard.TargetProperty="Width" From="1200"  To="50" Duration="00:00:04" />
            <DoubleAnimation Storyboard.TargetName="vbCamera" Storyboard.TargetProperty="Height" From="1200" To="50" Duration="00:00:04"/>
            <DoubleAnimation Storyboard.TargetName="vbCamera" Storyboard.TargetProperty="Opacity" From="1" To="0.2" Duration="00:00:04"/>
        </Storyboard>
                
        
        <Samples:StringCollection x:Key="DataSource"/>

        <DataTemplate x:Key="TestDataTemplate"
                      DataType="{x:Type sys:String}">
            <Border x:Name="ElementVisual"
                    Background="Transparent"
                    Padding="5"
                    BorderThickness="5"
                    BorderBrush="Transparent"
                    Grid.Row="0">
                <Image Source="{Binding}"
                       Stretch="Fill" />
            </Border>
        </DataTemplate>

        <DataTemplate x:Key="TestDataTemplate_Reflection">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="0.5*" />
                    <RowDefinition Height="0.5*" />
                </Grid.RowDefinitions>

                <Border x:Name="ElementVisual"
                        BorderThickness="2"
                        BorderBrush="LightYellow"
                        Background="Transparent"
                        Padding="2">
                    <Image Source="{Binding}"
                           Stretch="Fill" />
                </Border>
                <Rectangle OpacityMask="{StaticResource ReflectionBrush}"
                           Grid.Row="1"
                           Height="{Binding ActualHeight, ElementName=ElementVisual}">
                    <Rectangle.Fill>
                        <VisualBrush Visual="{Binding ElementName=ElementVisual}">
                            <VisualBrush.RelativeTransform>
                                <ScaleTransform ScaleX="1"
                                                ScaleY="-1"
                                                CenterX="0.5"
                                                CenterY="0.5" />
                            </VisualBrush.RelativeTransform>
                        </VisualBrush>
                    </Rectangle.Fill>
                </Rectangle>
            </Grid>
        </DataTemplate>
        <DataTemplate x:Key="ItemTemplate">
            <Border BorderBrush="#FFB1B1B1"
                    BorderThickness="2"
                    Background="#7FFFFFFF"
                    Padding="0,20,0,0"
                    CornerRadius="3">
                <Image Source="{Binding Image}"
                       HorizontalAlignment="Left"
                       VerticalAlignment="Top"
                       Stretch="Fill" />
            </Border>
        </DataTemplate>
    </Window.Resources>
    <Grid Name="GridPrincipal" ShowGridLines="False">
        <Grid.RowDefinitions>
            <RowDefinition Height="0.07*" />
            <RowDefinition Height="1*" />
            <RowDefinition Height="0.07*" />
            <RowDefinition Height="9*" />
            <RowDefinition Height="2*" />
            <RowDefinition Height="2*"/>
        </Grid.RowDefinitions>

        <Grid.ColumnDefinitions>
            <ColumnDefinition  Width="0.1*"/>
            <ColumnDefinition  Width="5*"/>
            <ColumnDefinition  Width="5*"/>
            <ColumnDefinition  Width="0.2*"/>
        </Grid.ColumnDefinitions>

        <Viewbox Grid.Row="1" Grid.Column="1" HorizontalAlignment="Left" Panel.ZIndex="1">
                <appControl:Logo />
        </Viewbox>

        <TextBlock Name="txbNomeAlbum" HorizontalAlignment="Center" TextAlignment="Center" Foreground="White" FontSize="40" FontWeight="DemiBold"  
                              Grid.Row="1"
                              Grid.Column="1"
                              Grid.ColumnSpan="2"/>

        <Grid x:Name="GridMain" Grid.Row="3" Grid.RowSpan="6" Grid.Column="0" Grid.ColumnSpan="4">
            <Controls:ElementFlow x:Name="_elementFlow"                              
                              ItemsSource="{DynamicResource DataSource}"
                              ItemTemplate="{DynamicResource TestDataTemplate}"   
                              PopoutDistance="0"
                              SelectedIndex="3" ElementHeight="600" ElementWidth="700">
                <Controls:ElementFlow.Layout>
                    <Controls:CoverFlow />
                </Controls:ElementFlow.Layout>
                <Controls:ElementFlow.Camera>
                    <PerspectiveCamera FieldOfView="50"
                                   Position="0,3,7"
                                   LookDirection="0,-3,-6" />
                </Controls:ElementFlow.Camera>
            </Controls:ElementFlow>
        </Grid>

        <Viewbox Name="vbTutorial" Stretch="Uniform"  Grid.Row="4" Grid.RowSpan="2" Grid.Column="1" Grid.ColumnSpan="2" HorizontalAlignment="Left" VerticalAlignment="Center" Panel.ZIndex="1" Opacity="0.95">
            <my:Tutorial x:Name="ucTutorial" PathVideo="Image/tutorial_carousel.avi"/>
        </Viewbox>
        
        <Viewbox Name="vbCamera" Stretch="Uniform" Grid.Row="4" Grid.RowSpan="2" Grid.Column="2" Grid.ColumnSpan="2" HorizontalAlignment="Right" VerticalAlignment="Center" Panel.ZIndex="1" >
            <my:CameraDraw x:Name="kinectCamera"/>
        </Viewbox>

        <Image Name="imgMedia" Grid.Row="1" Grid.Column="2" HorizontalAlignment="Right" Visibility="Visible" MouseDown="imgMedia_MouseDown"/>
    </Grid>
</Window>
